<?php

class Kpl_Action_Helper_AuthAdapterFactory extends Zend_Controller_Action_Helper_Abstract {

	public function getAuthAdapter() {

		$config = Util::getConfig();
		switch (strtolower($config->auth->type)) {
			case 'db':
				 return new Auth_Adapter_Db;
				 break;
			case 'ldap':
				$options = $config->ldap->toArray();
				unset($options['basic']);
				return new Auth_Adapter_Ldap($options);
				break;
			default:
				throw new Exception ("Specify auth adapter in appconfig.xml section auth, subsection type");
		}
	
	}
}